package ypmits.cms.view.components {
	import ypmits.components.util.TextFieldUtility;
	import ypmits.font.Arial;

	import flash.display.Sprite;
	import flash.filters.DropShadowFilter;
	import flash.text.TextFieldType;

	/**
	 * @author Dave Lenz
	 */
	public class CMSTextInput extends Sprite {

		private var _hasextratitle : Boolean;
		private var _ispassword : Boolean;
		
		public var invullerfield : TextFieldUtility;
		public var titlefield : TextFieldUtility;
		public var autoSelect : Boolean;
		public var text : String;

		
		
		public function CMSTextInput( hasextratitle : Boolean = false, ispassword : Boolean = false ) {
			_hasextratitle = hasextratitle;
			_ispassword = ispassword;
			
			draw();
			
			reset( );
		}

		
		
		private function draw() : void 
		{
			graphics.beginFill( 0xFFFFFF );
			graphics.drawRoundRect( 0, 0, 242, 41, 10 );
			
			titlefield = new TextFieldUtility( "", new Arial().fontName, 16, 0xFFFFFF );
			titlefield.x = -3;
			titlefield.y = -23;
			
			invullerfield = new TextFieldUtility( "", new Arial().fontName, 26, 0xFFFFFF );
			invullerfield.type = TextFieldType.INPUT;
			invullerfield.x = 6;
			invullerfield.y = 4;
			invullerfield.width = 225;
			if( _ispassword ) invullerfield.displayAsPassword = true;

			addChild( titlefield );
			if( !_hasextratitle ) titlefield.visible = false;
			addChild( invullerfield );
			
			filters = [ new DropShadowFilter(7, 45, 0, .35, 6, 6, 1, 3, true ) ];
		}

		
		
		public function reset( ) : void {
			invullerfield.text = "";
		}
	}
}
